package com.hefei.genericity;

import org.jetbrains.annotations.NotNull;

/**
 * @author caizhengjun
 * @date 2020/9/4 2:15 下午
 */
public class Demo06 {
    public static void main(String[] args) throws InstantiationException, IllegalAccessException {
        Student student = genericMethod(Student.class);
        student.setName("蔡正峻")
                .setAge(25);

        System.out.println("student = " + student);
    }

    private static <T> T genericMethod(@NotNull Class<T> tClass/*, Class<K> kClass, Class<V> vClass*/)
            throws IllegalAccessException, InstantiationException {

        //K k = kClass.newInstance();

        //V v = vClass.newInstance();

        return tClass.newInstance();
    }
}
